<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<jsp:include page="/admin/header.jsp"></jsp:include>
<div class="main">
	<div class="body container">
		<div class="typecho-page-title">
			<h2>
				管理独立页面<a href="${options.siteUrl}/admin/write-page">新增</a>
			</h2>
		</div>
		<div class="row typecho-page-main" role="main">
			<div class="col-mb-12 typecho-list">
				<div class="typecho-list-operate clearfix">
					<form method="get">
						<div class="operate">
							<label><i class="sr-only">全选</i><input type="checkbox"
								class="typecho-table-select-all"></label>
							<div class="btn-group btn-drop">
								<button class="btn dropdown-toggle btn-s" type="button">
									<i class="sr-only">操作</i>选中项 <i class="i-caret-down"></i>
								</button>
								<ul class="dropdown-menu">
									<li><a lang="你确认要删除这些页面吗?"
										href="${options.siteUrl}/action/admin?do=deletePages">删除</a></li>
								</ul>
							</div>
						</div>

						<div class="search" role="search">
							<input type="text" class="text-s" placeholder="请输入关键字" value=""
								name="keywords">
							<button type="submit" class="btn btn-s">筛选</button>
						</div>
					</form>
				</div>
				<!-- end .typecho-list-operate -->

				<form method="post" name="manage_pages" class="operate-form">
					<div class="typecho-table-wrap">
						<table class="typecho-list-table">
							<colgroup>
								<col width="10%">
								<col width="10%">
								<col width="40%">
								<col width="40%">
							</colgroup>
							<thead>
								<tr class="nodrag">
									<th></th>
									<th></th>
									<th>标题</th>
									<th>缩略名</th>
								</tr>
							</thead>
							<tfoot>
								<tr>
									<td style="padding: 0; height: 0; line-height: 0; border: none"
										colspan="6"></td>
								</tr>
							</tfoot>
							<tbody>
								<c:forEach var="page" items="${pages}">
									<tr id="page-${page['cid'] }" style="cursor: move;">
										<td style="height: 21px;"><input type="checkbox"
											value="${page['cid'] }" name="cid[]"></td>
										<td style="height: 21px;"><a
											href="http://localhost/typecho/admin/manage/comments?cid=${page['cid'] }"
											class="balloon-button size-1">${page['commentsNum'] }</a></td>
										<td style="height: 21px;"><a
											href="${options.siteUrl}/admin/write-page?cid=${page['cid'] }">${page['title'] }</a>
											<a href="${options.siteUrl}/page/${page['slug'] }"
											title="浏览 ${page['title'] }" target="_blank"><i
												class="i-exlink"></i></a></td>
										<td style="height: 21px;">${page['slug'] }</td>
									</tr>
								</c:forEach>

							</tbody>
						</table>
					</div>
					<!-- end .typecho-table-wrap -->
				</form>
				<!-- end .operate-form -->
			</div>
			<!-- end .typecho-list -->
		</div>
		<!-- end .typecho-page-main -->
	</div>
</div>
<jsp:include page="/admin/copyright.jsp"></jsp:include>
<jsp:include page="/admin/common-js.jsp"></jsp:include>
<script>
	(function() {
		$(document).ready(function() {
			$('.typecho-list-table').tableSelectable({
				checkEl : 'input[type=checkbox]',
				rowEl : 'tr',
				selectAllEl : '.typecho-table-select-all',
				actionEl : '.dropdown-menu a,button.btn-operate'
			});

			$('.btn-drop').dropdownMenu({
				btnEl : '.dropdown-toggle',
				menuEl : '.dropdown-menu'
			});
		});
	})();
</script>
<script type="text/javascript">
	(function() {
		$(document)
				.ready(
						function() {
							var table = $('.typecho-list-table')
									.tableDnD(
											{
												onDrop : function() {
													var ids = [];

													$('input[type=checkbox]',
															table)
															.each(
																	function() {
																		ids
																				.push($(
																						this)
																						.val());
																	});

													$
															.post(
																	'<?php $security->index('/action/contents-page-edit?do=sort'); ?>',
																	$
																			.param({
																				cid : ids
																			}));
												}
											});
						});
	})();
</script>
<jsp:include page="/admin/footer.jsp"></jsp:include>
